﻿-var t_dt = ViewData["DataTable"] as DataTable
-var t_cols = ViewData["Columns"] as List<Column>
-var t_viscols = ViewData["VisibleColumns"] as Column[]
-string t_pk = ViewData.ContainsKey("PrimaryKey") ? ViewData["PrimaryKey"].ToString() : null
=HTMLHelper.HiddenInput("tablecontroller",ViewData["Controller"])
=HTMLHelper.HiddenInput("tableaction",ViewData["Action"])
%table.data{width="100%",border="1"}
  %tr
    -foreach(var t_c in t_viscols)
      %th{width=string.Format("{0}%",t_c.Width)}
        %nobr
          =(t_c.ShortTitle ?? t_c.Title)
  -bool odd = true
  -foreach(DataRow t_dr in t_dt.Rows)
    -odd = !odd
    %tr{class=odd?"odd":""}
      -foreach(var t_c in t_viscols)
        %td{class=t_c.CssClass}=t_dr[t_c.Id]
  -if(ViewData.ContainsKey("Total"))
    -var total = ViewData["Total"] as Dictionary<string,decimal>
    %tr.total
      -foreach(var t_c in t_viscols)
        %td
          -if(t_c.CountTotal)
            =total[t_c.Id]